<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="include :: header('修改项目')" />
	<th:block th:include="include :: select2-css" />
</head>
<body>
<div class="main-content">
	<form class="form-horizontal" id="form-project-edit" th:object="${project}">
		<input name="userId"  type="hidden"  th:field="*{pid}" />
		<h4 class="form-header h4">项目信息</h4>
		<div class="row">
			<div class="col-sm-6">
				<div class="form-group">
					<label class="col-sm-4 control-label"><span style="color: red; ">*</span>项目id：</label>
					<div class="col-sm-8">
						<input name="pid"  class="form-control" type="text" maxlength="11" th:field="*{pid}" >
					</div>
				</div>
			</div>
			<div class="col-sm-6">
				<div class="form-group">
					<label class="col-sm-4 control-label"><span style="color: red; ">*</span>项目负责人：</label>
					<div class="col-sm-8">
						<input name="pmanager"  class="form-control" type="text" maxlength="11" th:field="*{pmanager}" >
					</div>
				</div>
			</div>
		</div>
		<div class="row">
			<div class="col-sm-6">
				<div class="form-group">
					<label class="col-sm-4 control-label"><span style="color: red; ">*</span>项目名称：</label>
					<div class="col-sm-8">
						<input name="pname" placeholder="请输入项目名称" class="form-control" type="text" maxlength="30" th:field="*{pname}" required>
					</div>
				</div>
			</div>
			<div class="col-sm-6">
				<div class="form-group">
					<label class="col-sm-4 control-label"><span style="color: red; ">*</span>项目时间：</label>
					<div class="col-sm-8">
						<input name="starttime" placeholder="请输入项目时间" class="form-control" type="text" maxlength="30" th:field="*{starttime}" required>
					</div>
				</div>
			</div>

		</div>
		<div class="row">
			<div class="col-sm-6">
				<div class="form-group">
					<label class="col-sm-4 control-label"><span style="color: red; ">*</span>项目图纸：</label>
					<div class="col-sm-8">
						<input name="drawing"  class="form-control" type="text" maxlength="11" th:field="*{drawing}" >
					</div>
				</div>
			</div>
			<div class="col-sm-6">
				<div class="form-group">
					<label class="col-sm-4 control-label"><span style="color: red; ">*</span>效果图：</label>
					<div class="col-sm-8">
						<input name="picture"  class="form-control" type="text" maxlength="11" th:field="*{picture}" >
					</div>
				</div>
			</div>
		</div>
		<div class="row">
			<div class="col-sm-6">
				<div class="form-group">
					<label class="col-sm-4 control-label"><span style="color: red; ">*</span>材料清单：</label>
					<div class="col-sm-8">
						<input name="materials"  class="form-control" type="text" maxlength="11" th:field="*{materials}" >
					</div>
				</div>
			</div>
			<div class="col-sm-6">
				<div class="form-group">
					<label class="col-sm-4 control-label"><span style="color: red; ">*</span>项目简介：</label>
					<div class="col-sm-8">
						<input name="pdesc"  class="form-control" type="text" maxlength="11" th:field="*{pdesc}" >
					</div>
				</div>
			</div>
		</div>

		<div class="row">
			<div class="col-sm-6">
				<div class="form-group">
					<label class="col-sm-4 control-label"><span style="color: red; ">*</span>项目详细说明：</label>
					<div class="col-sm-8">
						<input name="details"  class="form-control" type="text" maxlength="30" th:field="*{details}" >
					</div>
				</div>
			</div>
		</div>

	</form>
</div>
<div class="row">
	<div class="col-sm-offset-5 col-sm-10">
		<button type="button" class="btn btn-sm btn-primary" onclick="submitHandler()"><i class="fa fa-check"></i>保 存</button>&nbsp;
		<button type="button" class="btn btn-sm btn-danger" onclick="closeItem()"><i class="fa fa-reply-all"></i>关 闭 </button>
	</div>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: select2-js" />
<script type="text/javascript">
	var prefix = ctx + "knowledge/project";

	$("#form-project-edit").validate({
		/*onkeyup: false,
		rules:{
			pname:{
				email:true,
				remote: {
					url: prefix + "/checkProjectNameUnique",
					type: "post",
					dataType: "json",
					data: {
						"pname": function() {
							return $("#pname").val();
						},

					},
					dataFilter: function (data, type) {
						return $.validate.unique(data);
					}
				}
			},

		},
		messages: {
			"pname": {
				remote: "项目名称已经存在"
			},

		},*/
		focusCleanup: true
	});

	function submitHandler() {
		if ($.validate.form()) {
			var rs = $('#form-project-edit').serialize();
			console.log(rs);
			$.operate.save(prefix + "/edit", $('#form-project-edit').serialize());
			/*var data = $("#form-project-edit").serializeArray();
			var pnames = $.form.selectCheckeds("project");
			data.push({"name": "pnames", "value": pnames});
			$.operate.saveTab(prefix + "/edit", data);*/
		}
	}



</script>
</body>
</html>